package com.loukou.lkt.lkt.dao;

import java.util.List;

import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.transaction.annotation.Transactional;

import com.loukou.lkt.lkt.entity.AllocationOrderDetail;

public interface AllocationOrderDetailDao extends CrudRepository<AllocationOrderDetail, Integer>{
          List<AllocationOrderDetail> findByOrderId(int orderId);
      	
        @Modifying
    	@Transactional
    	@Query("update AllocationOrderDetail set send_quantity = ?2 where id = ?1")
		void updateSendQuantity(int allocationDetailId, int sendQuantity);

        @Modifying
    	@Transactional
    	@Query("update AllocationOrderDetail set receive_quantity = ?2 where id = ?1")
		void updateReceiveQuantity(int allocationDetailId, int receiveQuantity);
        
        AllocationOrderDetail findByOrderIdAndOutGoodsId(int orderId,int outGoodsId);
}
